home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / gdb-4.12 / gdb / m2-exp-t.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-03  |  52.0 KB  |  1,860 lines

  1.  
  2. # line 40 "./m2-exp.y"
  3.  
  4. #include "defs.h"
  5. #include "expression.h"
  6. #include "language.h"
  7. #include "value.h"
  8. #include "parser-defs.h"
  9. #include "m2-lang.h"
  10. #include "bfd.h" /* Required by objfiles.h.  */
  11. #include "symfile.h" /* Required by objfiles.h.  */
  12. #include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
  13.  
  14. /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
  15.    as well as gratuitiously global symbol names, so we can have multiple
  16.    yacc generated parsers in gdb.  Note that these are only the variables
  17.    produced by yacc.  If other parser generators (bison, byacc, etc) produce
  18.    additional global names that conflict at link time, then those parser
  19.    generators need to be fixed instead of adding those names to this list. */
  20.  
  21. #define    yymaxdepth m2_maxdepth
  22. #define    yyparse    m2_parse
  23. #define    yylex    m2_lex
  24. #define    yyerror    m2_error
  25. #define    yylval    m2_lval
  26. #define    yychar    m2_char
  27. #define    yydebug    m2_debug
  28. #define    yypact    m2_pact
  29. #define    yyr1    m2_r1
  30. #define    yyr2    m2_r2
  31. #define    yydef    m2_def
  32. #define    yychk    m2_chk
  33. #define    yypgo    m2_pgo
  34. #define    yyact    m2_act
  35. #define    yyexca    m2_exca
  36. #define    yyerrflag m2_errflag
  37. #define    yynerrs    m2_nerrs
  38. #define    yyps    m2_ps
  39. #define    yypv    m2_pv
  40. #define    yys    m2_s
  41. #define    yy_yys    m2_yys
  42. #define    yystate    m2_state
  43. #define    yytmp    m2_tmp
  44. #define    yyv    m2_v
  45. #define    yy_yyv    m2_yyv
  46. #define    yyval    m2_val
  47. #define    yylloc    m2_lloc
  48. #define    yyreds    m2_reds        /* With YYDEBUG defined */
  49. #define    yytoks    m2_toks        /* With YYDEBUG defined */
  50.  
  51. #ifndef YYDEBUG
  52. #define    YYDEBUG    0        /* Default to no yydebug support */
  53. #endif
  54.  
  55. int
  56. yyparse PARAMS ((void));
  57.  
  58. static int
  59. yylex PARAMS ((void));
  60.  
  61. void
  62. yyerror PARAMS ((char *));
  63.  
  64. #if 0
  65. static char *
  66. make_qualname PARAMS ((char *, char *));
  67. #endif
  68.  
  69. static int
  70. parse_number PARAMS ((int));
  71.  
  72. /* The sign of the number being parsed. */
  73. static int number_sign = 1;
  74.  
  75. /* The block that the module specified by the qualifer on an identifer is
  76.    contained in, */
  77. #if 0
  78. static struct block *modblock=0;
  79. #endif
  80.  
  81.  
  82. # line 124 "./m2-exp.y"
  83. typedef union 
  84.   {
  85.     LONGEST lval;
  86.     unsigned LONGEST ulval;
  87.     double dval;
  88.     struct symbol *sym;
  89.     struct type *tval;
  90.     struct stoken sval;
  91.     int voidval;
  92.     struct block *bval;
  93.     enum exp_opcode opcode;
  94.     struct internalvar *ivar;
  95.  
  96.     struct type **tvec;
  97.     int *ivec;
  98.   } YYSTYPE;
  99. # define INT 257
  100. # define HEX 258
  101. # define ERROR 259
  102. # define UINT 260
  103. # define M2_TRUE 261
  104. # define M2_FALSE 262
  105. # define CHAR 263
  106. # define FLOAT 264
  107. # define STRING 265
  108. # define NAME 266
  109. # define BLOCKNAME 267
  110. # define IDENT 268
  111. # define VARNAME 269
  112. # define TYPENAME 270
  113. # define SIZE 271
  114. # define CAP 272
  115. # define ORD 273
  116. # define HIGH 274
  117. # define ABS 275
  118. # define MIN_FUNC 276
  119. # define MAX_FUNC 277
  120. # define FLOAT_FUNC 278
  121. # define VAL 279
  122. # define CHR 280
  123. # define ODD 281
  124. # define TRUNC 282
  125. # define INC 283
  126. # define DEC 284
  127. # define INCL 285
  128. # define EXCL 286
  129. # define COLONCOLON 287
  130. # define LAST 288
  131. # define REGNAME 289
  132. # define INTERNAL_VAR 290
  133. # define ABOVE_COMMA 291
  134. # define ASSIGN 292
  135. # define LEQ 293
  136. # define GEQ 294
  137. # define NOTEQUAL 295
  138. # define IN 296
  139. # define OROR 297
  140. # define LOGICAL_AND 298
  141. # define DIV 299
  142. # define MOD 300
  143. # define UNARY 301
  144. # define DOT 302
  145. # define NOT 303
  146. # define QID 304
  147. #define yyclearin yychar = -1
  148. #define yyerrok yyerrflag = 0
  149. extern int yychar;
  150. extern int yyerrflag;
  151. #ifndef YYMAXDEPTH
  152. #define YYMAXDEPTH 150
  153. #endif
  154. YYSTYPE yylval, yyval;
  155. # define YYERRCODE 256
  156.  
  157. # line 650 "./m2-exp.y"
  158.  
  159.  
  160. #if 0  /* FIXME! */
  161. int
  162. overflow(a,b)
  163.    long a,b;
  164. {
  165.    return (MAX_OF_TYPE(builtin_type_m2_int) - b) < a;
  166. }
  167.  
  168. int
  169. uoverflow(a,b)
  170.    unsigned long a,b;
  171. {
  172.    return (MAX_OF_TYPE(builtin_type_m2_card) - b) < a;
  173. }
  174. #endif /* FIXME */
  175.  
  176. /* Take care of parsing a number (anything that starts with a digit).
  177.    Set yylval and return the token type; update lexptr.
  178.    LEN is the number of characters in it.  */
  179.  
  180. /*** Needs some error checking for the float case ***/
  181.  
  182. static int
  183. parse_number (olen)
  184.      int olen;
  185. {
  186.   register char *p = lexptr;
  187.   register LONGEST n = 0;
  188.   register LONGEST prevn = 0;
  189.   register int c,i,ischar=0;
  190.   register int base = input_radix;
  191.   register int len = olen;
  192.   int unsigned_p = number_sign == 1 ? 1 : 0;
  193.  
  194.   if(p[len-1] == 'H')
  195.   {
  196.      base = 16;
  197.      len--;
  198.   }
  199.   else if(p[len-1] == 'C' || p[len-1] == 'B')
  200.   {
  201.      base = 8;
  202.      ischar = p[len-1] == 'C';
  203.      len--;
  204.   }
  205.  
  206.   /* Scan the number */
  207.   for (c = 0; c < len; c++)
  208.   {
  209.     if (p[c] == '.' && base == 10)
  210.       {
  211.     /* It's a float since it contains a point.  */
  212.     yylval.dval = atof (p);
  213.     lexptr += len;
  214.     return FLOAT;
  215.       }
  216.     if (p[c] == '.' && base != 10)
  217.        error("Floating point numbers must be base 10.");
  218.     if (base == 10 && (p[c] < '0' || p[c] > '9'))
  219.        error("Invalid digit \'%c\' in number.",p[c]);
  220.  }
  221.  
  222.   while (len-- > 0)
  223.     {
  224.       c = *p++;
  225.       n *= base;
  226.       if( base == 8 && (c == '8' || c == '9'))
  227.      error("Invalid digit \'%c\' in octal number.",c);
  228.       if (c >= '0' && c <= '9')
  229.     i = c - '0';
  230.       else
  231.     {
  232.       if (base == 16 && c >= 'A' && c <= 'F')
  233.         i = c - 'A' + 10;
  234.       else
  235.          return ERROR;
  236.     }
  237.       n+=i;
  238.       if(i >= base)
  239.      return ERROR;
  240.       if(!unsigned_p && number_sign == 1 && (prevn >= n))
  241.      unsigned_p=1;        /* Try something unsigned */
  242.       /* Don't do the range check if n==i and i==0, since that special
  243.      case will give an overflow error. */
  244.       if(RANGE_CHECK && n!=i && i)
  245.       {
  246.      if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
  247.         ((!unsigned_p && number_sign==-1) && -prevn <= -n))
  248.         range_error("Overflow on numeric constant.");
  249.       }
  250.      prevn=n;
  251.     }
  252.  
  253.   lexptr = p;
  254.   if(*p == 'B' || *p == 'C' || *p == 'H')
  255.      lexptr++;            /* Advance past B,C or H */
  256.  
  257.   if (ischar)
  258.   {
  259.      yylval.ulval = n;
  260.      return CHAR;
  261.   }
  262.   else if ( unsigned_p && number_sign == 1)
  263.   {
  264.      yylval.ulval = n;
  265.      return UINT;
  266.   }
  267.   else if((unsigned_p && (n<0))) {
  268.      range_error("Overflow on numeric constant -- number too large.");
  269.      /* But, this can return if range_check == range_warn.  */
  270.   }
  271.   yylval.lval = n;
  272.   return INT;
  273. }
  274.  
  275.  
  276. /* Some tokens */
  277.  
  278. static struct
  279. {
  280.    char name[2];
  281.    int token;
  282. } tokentab2[] =
  283. {
  284.     { {'<', '>'},    NOTEQUAL     },
  285.     { {':', '='},    ASSIGN    },
  286.     { {'<', '='},    LEQ    },
  287.     { {'>', '='},    GEQ    },
  288.     { {':', ':'},    COLONCOLON },
  289.  
  290. };
  291.  
  292. /* Some specific keywords */
  293.  
  294. struct keyword {
  295.    char keyw[10];
  296.    int token;
  297. };
  298.  
  299. static struct keyword keytab[] =
  300. {
  301.     {"OR" ,   OROR     },
  302.     {"IN",    IN         },/* Note space after IN */
  303.     {"AND",   LOGICAL_AND},
  304.     {"ABS",   ABS     },
  305.     {"CHR",   CHR     },
  306.     {"DEC",   DEC     },
  307.     {"NOT",   NOT     },
  308.     {"DIV",   DIV         },
  309.     {"INC",   INC     },
  310.     {"MAX",   MAX_FUNC     },
  311.     {"MIN",   MIN_FUNC     },
  312.     {"MOD",   MOD     },
  313.     {"ODD",   ODD     },
  314.     {"CAP",   CAP     },
  315.     {"ORD",   ORD     },
  316.     {"VAL",   VAL     },
  317.     {"EXCL",  EXCL     },
  318.     {"HIGH",  HIGH       },
  319.     {"INCL",  INCL     },
  320.     {"SIZE",  SIZE       },
  321.     {"FLOAT", FLOAT_FUNC },
  322.     {"TRUNC", TRUNC     },
  323. };
  324.  
  325.  
  326. /* Read one token, getting characters through lexptr.  */
  327.  
  328. /* This is where we will check to make sure that the language and the operators used are
  329.    compatible  */
  330.  
  331. static int
  332. yylex ()
  333. {
  334.   register int c;
  335.   register int namelen;
  336.   register int i;
  337.   register char *tokstart;
  338.   register char quote;
  339.  
  340.  retry:
  341.  
  342.   tokstart = lexptr;
  343.  
  344.  
  345.   /* See if it is a special token of length 2 */
  346.   for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
  347.      if(STREQN(tokentab2[i].name, tokstart, 2))
  348.      {
  349.     lexptr += 2;
  350.     return tokentab2[i].token;
  351.      }
  352.  
  353.   switch (c = *tokstart)
  354.     {
  355.     case 0:
  356.       return 0;
  357.  
  358.     case ' ':
  359.     case '\t':
  360.     case '\n':
  361.       lexptr++;
  362.       goto retry;
  363.  
  364.     case '(':
  365.       paren_depth++;
  366.       lexptr++;
  367.       return c;
  368.  
  369.     case ')':
  370.       if (paren_depth == 0)
  371.     return 0;
  372.       paren_depth--;
  373.       lexptr++;
  374.       return c;
  375.  
  376.     case ',':
  377.       if (comma_terminates && paren_depth == 0)
  378.     return 0;
  379.       lexptr++;
  380.       return c;
  381.  
  382.     case '.':
  383.       /* Might be a floating point number.  */
  384.       if (lexptr[1] >= '0' && lexptr[1] <= '9')
  385.     break;            /* Falls into number code.  */
  386.       else
  387.       {
  388.      lexptr++;
  389.      return DOT;
  390.       }
  391.  
  392. /* These are character tokens that appear as-is in the YACC grammar */
  393.     case '+':
  394.     case '-':
  395.     case '*':
  396.     case '/':
  397.     case '^':
  398.     case '<':
  399.     case '>':
  400.     case '[':
  401.     case ']':
  402.     case '=':
  403.     case '{':
  404.     case '}':
  405.     case '#':
  406.     case '@':
  407.     case '~':
  408.     case '&':
  409.       lexptr++;
  410.       return c;
  411.  
  412.     case '\'' :
  413.     case '"':
  414.       quote = c;
  415.       for (namelen = 1; (c = tokstart[namelen]) != quote && c != '\0'; namelen++)
  416.     if (c == '\\')
  417.       {
  418.         c = tokstart[++namelen];
  419.         if (c >= '0' && c <= '9')
  420.           {
  421.         c = tokstart[++namelen];
  422.         if (c >= '0' && c <= '9')
  423.           c = tokstart[++namelen];
  424.           }
  425.       }
  426.       if(c != quote)
  427.      error("Unterminated string or character constant.");
  428.       yylval.sval.ptr = tokstart + 1;
  429.       yylval.sval.length = namelen - 1;
  430.       lexptr += namelen + 1;
  431.  
  432.       if(namelen == 2)      /* Single character */
  433.       {
  434.        yylval.ulval = tokstart[1];
  435.        return CHAR;
  436.       }
  437.       else
  438.      return STRING;
  439.     }
  440.  
  441.   /* Is it a number?  */
  442.   /* Note:  We have already dealt with the case of the token '.'.
  443.      See case '.' above.  */
  444.   if ((c >= '0' && c <= '9'))
  445.     {
  446.       /* It's a number.  */
  447.       int got_dot = 0, got_e = 0;
  448.       register char *p = tokstart;
  449.       int toktype;
  450.  
  451.       for (++p ;; ++p)
  452.     {
  453.       if (!got_e && (*p == 'e' || *p == 'E'))
  454.         got_dot = got_e = 1;
  455.       else if (!got_dot && *p == '.')
  456.         got_dot = 1;
  457.       else if (got_e && (p[-1] == 'e' || p[-1] == 'E')
  458.            && (*p == '-' || *p == '+'))
  459.         /* This is the sign of the exponent, not the end of the
  460.            number.  */
  461.         continue;
  462.       else if ((*p < '0' || *p > '9') &&
  463.            (*p < 'A' || *p > 'F') &&
  464.            (*p != 'H'))  /* Modula-2 hexadecimal number */
  465.         break;
  466.     }
  467.     toktype = parse_number (p - tokstart);
  468.         if (toktype == ERROR)
  469.       {
  470.         char *err_copy = (char *) alloca (p - tokstart + 1);
  471.  
  472.         memcpy (err_copy, tokstart, p - tokstart);
  473.         err_copy[p - tokstart] = 0;
  474.         error ("Invalid number \"%s\".", err_copy);
  475.       }
  476.     lexptr = p;
  477.     return toktype;
  478.     }
  479.  
  480.   if (!(c == '_' || c == '$'
  481.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')))
  482.     /* We must have come across a bad character (e.g. ';').  */
  483.     error ("Invalid character '%c' in expression.", c);
  484.  
  485.   /* It's a name.  See how long it is.  */
  486.   namelen = 0;
  487.   for (c = tokstart[namelen];
  488.        (c == '_' || c == '$' || (c >= '0' && c <= '9')
  489.     || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'));
  490.        c = tokstart[++namelen])
  491.     ;
  492.  
  493.   /* The token "if" terminates the expression and is NOT
  494.      removed from the input stream.  */
  495.   if (namelen == 2 && tokstart[0] == 'i' && tokstart[1] == 'f')
  496.     {
  497.       return 0;
  498.     }
  499.  
  500.   lexptr += namelen;
  501.  
  502.   /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
  503.      and $$digits (equivalent to $<-digits> if you could type that).
  504.      Make token type LAST, and put the number (the digits) in yylval.  */
  505.  
  506.   if (*tokstart == '$')
  507.     {
  508.       register int negate = 0;
  509.       c = 1;
  510.       /* Double dollar means negate the number and add -1 as well.
  511.      Thus $$ alone means -1.  */
  512.       if (namelen >= 2 && tokstart[1] == '$')
  513.     {
  514.       negate = 1;
  515.       c = 2;
  516.     }
  517.       if (c == namelen)
  518.     {
  519.       /* Just dollars (one or two) */
  520.       yylval.lval = - negate;
  521.       return LAST;
  522.     }
  523.       /* Is the rest of the token digits?  */
  524.       for (; c < namelen; c++)
  525.     if (!(tokstart[c] >= '0' && tokstart[c] <= '9'))
  526.       break;
  527.       if (c == namelen)
  528.     {
  529.       yylval.lval = atoi (tokstart + 1 + negate);
  530.       if (negate)
  531.         yylval.lval = - yylval.lval;
  532.       return LAST;
  533.     }
  534.     }
  535.  
  536.   /* Handle tokens that refer to machine registers:
  537.      $ followed by a register name.  */
  538.  
  539.   if (*tokstart == '$') {
  540.     for (c = 0; c < NUM_REGS; c++)
  541.       if (namelen - 1 == strlen (reg_names[c])
  542.       && STREQN (tokstart + 1, reg_names[c], namelen - 1))
  543.     {
  544.       yylval.lval = c;
  545.       return REGNAME;
  546.     }
  547.     for (c = 0; c < num_std_regs; c++)
  548.      if (namelen - 1 == strlen (std_regs[c].name)
  549.      && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
  550.        {
  551.      yylval.lval = std_regs[c].regnum;
  552.      return REGNAME;
  553.        }
  554.   }
  555.  
  556.  
  557.   /*  Lookup special keywords */
  558.   for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
  559.      if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
  560.        return keytab[i].token;
  561.  
  562.   yylval.sval.ptr = tokstart;
  563.   yylval.sval.length = namelen;
  564.  
  565.   /* Any other names starting in $ are debugger internal variables.  */
  566.  
  567.   if (*tokstart == '$')
  568.     {
  569.       yylval.ivar = (struct internalvar *) lookup_internalvar (copy_name (yylval.sval) + 1);
  570.       return INTERNAL_VAR;
  571.     }
  572.  
  573.  
  574.   /* Use token-type BLOCKNAME for symbols that happen to be defined as
  575.      functions.  If this is not so, then ...
  576.      Use token-type TYPENAME for symbols that happen to be defined
  577.      currently as names of types; NAME for other symbols.
  578.      The caller is not constrained to care about the distinction.  */
  579.  {
  580.  
  581.  
  582.     char *tmp = copy_name (yylval.sval);
  583.     struct symbol *sym;
  584.  
  585.     if (lookup_partial_symtab (tmp))
  586.       return BLOCKNAME;
  587.     sym = lookup_symbol (tmp, expression_context_block,
  588.              VAR_NAMESPACE, 0, NULL);
  589.     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
  590.       return BLOCKNAME;
  591.     if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
  592.       return TYPENAME;
  593.  
  594.     if(sym)
  595.     {
  596.        switch(sym->class)
  597.        {
  598.        case LOC_STATIC:
  599.        case LOC_REGISTER:
  600.        case LOC_ARG:
  601.        case LOC_REF_ARG:
  602.        case LOC_REGPARM:
  603.        case LOC_REGPARM_ADDR:
  604.        case LOC_LOCAL:
  605.        case LOC_LOCAL_ARG:
  606.        case LOC_BASEREG:
  607.        case LOC_BASEREG_ARG:
  608.        case LOC_CONST:
  609.        case LOC_CONST_BYTES:
  610.        case LOC_OPTIMIZED_OUT:
  611.       return NAME;
  612.  
  613.        case LOC_TYPEDEF:
  614.       return TYPENAME;
  615.  
  616.        case LOC_BLOCK:
  617.       return BLOCKNAME;
  618.  
  619.        case LOC_UNDEF:
  620.       error("internal:  Undefined class in m2lex()");
  621.  
  622.        case LOC_LABEL:
  623.       error("internal:  Unforseen case in m2lex()");
  624.        }
  625.     }
  626.     else
  627.     {
  628.        /* Built-in BOOLEAN type.  This is sort of a hack. */
  629.        if(STREQN(tokstart,"TRUE",4))
  630.        {
  631.       yylval.ulval = 1;
  632.       return M2_TRUE;
  633.        }
  634.        else if(STREQN(tokstart,"FALSE",5))
  635.        {
  636.       yylval.ulval = 0;
  637.       return M2_FALSE;
  638.        }
  639.     }
  640.  
  641.     /* Must be another type of name... */
  642.     return NAME;
  643.  }
  644. }
  645.  
  646. #if 0        /* Unused */
  647. static char *
  648. make_qualname(mod,ident)
  649.    char *mod, *ident;
  650. {
  651.    char *new = xmalloc(strlen(mod)+strlen(ident)+2);
  652.  
  653.    strcpy(new,mod);
  654.    strcat(new,".");
  655.    strcat(new,ident);
  656.    return new;
  657. }
  658. #endif  /* 0 */
  659.  
  660. void
  661. yyerror(msg)
  662.      char *msg;    /* unused */
  663. {
  664.    printf_unfiltered("Parsing:  %s\n",lexptr);
  665.    if (yychar < 256)
  666.      error("Invalid syntax in expression near character '%c'.",yychar);
  667.    else
  668.      error("Invalid syntax in expression");
  669. }
  670.  
  671. int yyexca[] ={
  672. -1, 1,
  673.     0, -1,
  674.     -2, 0,
  675. -1, 40,
  676.     287, 74,
  677.     -2, 77,
  678. -1, 117,
  679.     292, 0,
  680.     -2, 62,
  681.     };
  682. # define YYNPROD 82
  683. # define YYLAST 1355
  684. int yyact[]={
  685.  
  686.     26,    94,    97,     5,    39,     4,   142,   141,    95,    92,
  687.    136,    91,   136,    88,   169,   153,    92,   157,    92,   100,
  688.    170,    21,   151,   136,   150,    87,    86,    85,    84,    81,
  689.     80,    79,    78,    49,    83,    51,    55,     5,    56,     4,
  690.     52,    59,    77,    76,    75,    74,    49,   160,    51,    55,
  691.    161,    56,    59,    52,    73,    72,    49,    49,   158,    51,
  692.     55,   159,    56,   168,    52,    71,    62,    57,    63,    96,
  693.     50,   143,    99,     6,    67,    40,    42,    62,    57,    63,
  694.     33,    50,     1,    24,    48,     3,    38,    45,     0,     0,
  695.      0,   166,    91,   135,   137,     0,    49,    48,    51,    91,
  696.     45,    91,     0,    52,     0,   138,     0,    48,    48,     0,
  697.     45,    45,     0,     0,   145,     0,    59,    24,     0,     0,
  698.     38,    49,   181,    51,    55,     0,    56,    59,    52,     0,
  699.      0,     0,    49,   180,    51,    55,     0,    56,     0,    52,
  700.      0,    62,    57,    63,     0,    50,     0,    48,     0,    39,
  701.     45,     0,    62,    57,    63,    59,    50,     0,     0,     0,
  702.     49,   179,    51,    55,     0,    56,     0,    52,     0,     0,
  703.      0,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  704.     62,    57,    63,    48,    50,     0,    45,     0,     0,     0,
  705.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  706.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  707.      0,    48,     0,     0,    45,     0,     0,    29,     0,     0,
  708.     30,    27,    28,    31,    32,    36,    43,    44,     0,     0,
  709.     39,    18,     7,     8,    10,     9,    11,    12,    13,    14,
  710.     15,    16,    17,    19,    20,    22,    23,     0,    34,    35,
  711.     41,    29,     0,     0,    30,    27,    28,    31,    32,    36,
  712.     43,    44,     0,    37,    39,    18,     7,     8,    10,     9,
  713.     11,    12,    13,    14,    15,    16,    17,    19,    20,    22,
  714.     23,     0,    34,    35,    41,     0,     0,     0,     0,     0,
  715.      0,     0,    53,    54,     0,    46,     0,    37,    66,    60,
  716.     61,    58,    47,    65,    64,    53,    54,     0,    46,    66,
  717.     60,    61,    58,    47,    65,    64,    53,    54,    46,    46,
  718.      0,     0,     0,    69,    25,     0,     0,     0,     0,     0,
  719.      0,     0,     0,     0,     0,     0,     0,    59,     0,     0,
  720.      0,     0,    49,   178,    51,    55,     0,    56,    89,    52,
  721.      0,     0,     0,     0,     0,    53,    54,     0,    46,     0,
  722.      0,     0,    62,    57,    63,     0,    50,     0,     0,     0,
  723.      0,    98,     0,    66,    60,    61,    58,    47,    65,    64,
  724.     53,    54,     0,    46,    66,    60,    61,    58,    47,    65,
  725.     64,    53,    54,    48,    46,     0,    45,     0,    59,   123,
  726.    124,     0,   126,    49,   177,    51,    55,   130,    56,     0,
  727.     52,     0,    66,    60,    61,    58,    47,    65,    64,    53,
  728.     54,     0,    46,    62,    57,    63,    59,    50,     0,     0,
  729.      0,    49,   167,    51,    55,     0,    56,    59,    52,     0,
  730.      0,     0,    49,     0,    51,    55,   163,    56,     0,    52,
  731.      0,    62,    57,    63,    48,    50,     0,    45,     0,     0,
  732.      0,     0,    62,    57,    63,    59,    50,     0,     0,     0,
  733.     49,     0,    51,    55,   162,    56,     0,    52,     0,     0,
  734.      0,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  735.     62,    57,    63,    48,    50,     0,    45,     0,     0,     0,
  736.     59,     0,     0,     0,     0,    49,   156,    51,    55,     0,
  737.     56,     0,    52,     0,     0,     0,     0,     0,     0,     0,
  738.      0,    48,     0,     0,    45,    62,    57,    63,    59,    50,
  739.      0,     0,     0,    49,   155,    51,    55,     0,    56,     0,
  740.     52,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  741.      0,     0,     0,    62,    57,    63,    48,    50,     0,    45,
  742.      0,     0,     0,    59,     0,     0,     0,     0,    49,   154,
  743.     51,    55,     0,    56,     0,    52,     0,     0,     0,     0,
  744.      0,     0,     0,     0,    48,     0,     0,    45,    62,    57,
  745.     63,     0,    50,     0,    66,    60,    61,    58,    47,    65,
  746.     64,    53,    54,     0,    46,     0,     0,     0,    59,     0,
  747.      0,     0,     0,    49,   152,    51,    55,     0,    56,    48,
  748.     52,     0,    45,     0,     0,     0,     0,     0,     0,     0,
  749.      0,     0,     0,    62,    57,    63,     0,    50,     0,     0,
  750.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  751.      0,     0,     0,     0,     0,    66,    60,    61,    58,    47,
  752.     65,    64,    53,    54,    48,    46,     0,    45,     0,     0,
  753.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  754.      0,     0,     0,    66,    60,    61,    58,    47,    65,    64,
  755.     53,    54,     0,    46,    66,    60,    61,    58,    47,    65,
  756.     64,    53,    54,     0,    46,     0,     0,     0,     0,     0,
  757.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  758.      0,     0,    66,    60,    61,    58,    47,    65,    64,    53,
  759.     54,     0,    46,     0,     0,     0,     0,     0,     0,     0,
  760.      0,     0,     0,    59,     0,     0,     0,     0,    49,   149,
  761.     51,    55,     0,    56,     0,    52,     0,    66,    60,    61,
  762.     58,    47,    65,    64,    53,    54,     0,    46,    62,    57,
  763.     63,     0,    50,     0,     0,     0,     0,     0,     0,     0,
  764.      0,     0,     0,     0,     0,    66,    60,    61,    58,    47,
  765.     65,    64,    53,    54,     0,    46,     0,     0,     0,    48,
  766.      0,     0,    45,     0,     0,     0,     0,     0,    49,     0,
  767.     51,    55,     0,    56,     0,    52,     0,     0,     0,     0,
  768.     66,    60,    61,    58,    47,    65,    64,    53,    54,    59,
  769.     46,     0,    50,     0,    49,   148,    51,    55,     0,    56,
  770.     49,    52,    51,    55,     0,    56,     0,    52,     0,     0,
  771.      0,     0,     0,     0,    62,    57,    63,     0,    50,    48,
  772.      0,     0,    45,     0,    50,    66,    60,    61,    58,    47,
  773.     65,    64,    53,    54,    59,    46,     0,     0,     0,    49,
  774.    147,    51,    55,     0,    56,    48,    52,     0,    45,     0,
  775.      0,    48,     0,     0,    45,     0,     0,     0,     0,    62,
  776.     57,    63,    59,    50,     0,     0,     0,    49,   146,    51,
  777.     55,     0,    56,    59,    52,     0,     0,     0,    49,   140,
  778.     51,    55,     0,    56,     0,    52,     0,    62,    57,    63,
  779.     48,    50,     0,    45,     0,     0,     0,     0,    62,    57,
  780.     63,     0,    50,     0,     0,     0,     0,     0,     0,     0,
  781.      0,     0,     0,     0,     0,    59,     0,     0,    48,     0,
  782.     49,    45,    51,    55,     0,    56,    59,    52,     0,    48,
  783.      0,    49,    45,    51,    55,     0,    56,     0,    52,     0,
  784.     62,    57,    63,     0,    50,     0,     0,     0,     0,     0,
  785.      0,    62,    57,    63,     0,    50,     0,     0,     0,     0,
  786.     66,    60,    61,    58,    47,    65,    64,    53,    54,     0,
  787.     46,    48,     0,     0,    45,     0,     0,     0,     0,     0,
  788.      0,    49,    48,    51,    55,    45,    56,     0,    52,     0,
  789.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  790.      0,     0,     0,     0,     0,    50,     0,     0,     0,     0,
  791.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  792.      0,     0,     0,     0,     0,    65,    64,    53,    54,     0,
  793.     46,     0,    48,     0,     0,    45,     0,     0,     0,     0,
  794.      0,     0,     0,     0,     0,     0,    66,    60,    61,    58,
  795.     47,    65,    64,    53,    54,     0,    46,     0,    64,    53,
  796.     54,     0,    46,     0,     0,     0,     0,     0,     0,     0,
  797.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  798.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  799.      0,    66,    60,    61,    58,    47,    65,    64,    53,    54,
  800.      0,    46,     0,     0,     0,     0,     0,     0,     0,     0,
  801.      0,     0,     0,     0,     0,     0,     0,     0,     0,    66,
  802.     60,    61,    58,    47,    65,    64,    53,    54,     0,    46,
  803.     66,    60,    61,    58,    47,    65,    64,    53,    54,     0,
  804.     46,     0,     0,     0,    90,     2,     0,     0,     0,     0,
  805.     68,    70,     0,     0,     0,     0,     0,     0,     0,     0,
  806.      0,     0,     0,    82,     0,     0,     0,     0,     0,     0,
  807.      0,    93,    66,    60,    61,    58,    47,    65,    64,    53,
  808.     54,     0,    46,     0,    60,    61,    58,    47,    65,    64,
  809.     53,    54,     0,    46,     0,   101,   102,   103,   104,   105,
  810.    106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
  811.    116,   117,   118,     0,     0,     0,   119,   120,   121,   122,
  812.      0,     0,   125,     0,   127,   128,   129,     0,    93,   131,
  813.    132,   133,   134,     0,     0,     0,     0,   139,     0,     0,
  814.     53,    54,     0,    46,   144,     0,     0,     0,     0,     0,
  815.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  816.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  817.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  818.      0,   164,   165,     0,     0,     0,     0,     0,     0,     0,
  819.      0,     0,     0,     0,     0,     0,     0,     0,   171,     0,
  820.      0,     0,     0,     0,   172,     0,   173,   174,   175,     0,
  821.      0,     0,     0,     0,   176 };
  822. int yypact[]={
  823.  
  824.    -40, -1000,   920, -1000, -1000,   -40,   -40,    25,    15,    14,
  825.      5,     4,     3,     2,    -8,    -9,   -10,   -11,    -6,   -12,
  826.    -13, -1000,   -14,   -15,   -40,   -22,   -40, -1000, -1000, -1000,
  827.  -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,
  828.  -1000, -1000,  -286, -1000, -1000, -1000,  -258,  -121, -1000, -1000,
  829.    -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,
  830.    -40,   -40,   -40,   -40,   -40,   -40,   -40,   -40,    16,   -22,
  831.     16,   -40,   -40,   -40,   -40,  -266,  -266,   -40,  -266,   -40,
  832.    -40,   -40,    16,   -40,   -40,   -40,   -40,   -40,   -32,   -31,
  833.    920,   -40,   -40,   878,  -260, -1000, -1000,   -40,  -112,   -40,
  834.    -40,    -7,    16,    16,    16,    16,    56,    56,   768,   768,
  835.    768,   768,   768,   768,   768,   981,   800,   931,    16,   867,
  836.    839,   794,   708,   -17,   -19,   573,   -29,   528,   493,   465,
  837.    -24,    17,     6,   430,   402, -1000,   -40,   -40,   -34,   391,
  838.  -1000, -1000, -1000,   -30,   920,   -21, -1000, -1000, -1000, -1000,
  839.  -1000, -1000, -1000,   -40, -1000, -1000, -1000, -1000, -1000,   -40,
  840.  -1000,   -40,   -40,   -40,   920,    16, -1000, -1000, -1000,   -40,
  841.  -1000,   363,   302,   120,    92,    81,   920, -1000, -1000, -1000,
  842.  -1000, -1000 };
  843. int yypgo[]={
  844.  
  845.      0,  1184,    85,    82,    21,    80,   323,    76,    75,    74,
  846.     73,    13,    72,    71,    19 };
  847. int yyr1[]={
  848.  
  849.      0,     3,     3,     2,     1,     9,     1,     1,     1,    10,
  850.     10,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  851.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  852.      1,     1,     4,     4,    12,     1,    14,     1,    11,    11,
  853.     11,    13,    13,     1,     1,     1,     1,     1,     1,     1,
  854.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  855.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  856.      1,     1,     1,     1,     7,     8,     8,     5,     5,     5,
  857.      5,     6 };
  858. int yyr2[]={
  859.  
  860.      0,     2,     2,     3,     5,     1,     7,     5,     5,     2,
  861.      2,     9,     9,     9,     9,     9,     9,     9,    13,     9,
  862.      9,     9,     5,     9,    13,     9,    13,     7,     2,     7,
  863.     13,    13,     7,     9,     1,    11,     1,    11,     0,     3,
  864.      7,     3,     7,     9,     9,     7,     7,     7,     7,     7,
  865.      7,     7,     7,     7,     7,     7,     7,     7,     7,     7,
  866.      7,     7,     7,     3,     3,     3,     3,     3,     3,     2,
  867.      3,     3,     9,     3,     3,     3,     7,     3,     3,     7,
  868.      3,     3 };
  869. int yychk[]={
  870.  
  871.  -1000,    -3,    -1,    -2,    45,    43,   -10,   272,   273,   275,
  872.    274,   276,   277,   278,   279,   280,   281,   282,   271,   283,
  873.    284,    -4,   285,   286,   123,    -6,    40,   261,   262,   257,
  874.    260,   263,   264,    -5,   288,   289,   265,   303,   126,   270,
  875.     -8,   290,    -7,   266,   267,    94,   302,   296,    91,    40,
  876.     64,    42,    47,   299,   300,    43,    45,    61,   295,    35,
  877.    293,   294,    60,    62,   298,   297,   292,    -9,    -1,    -6,
  878.     -1,    40,    40,    40,    40,    40,    40,    40,    40,    40,
  879.     40,    40,    -1,    40,    40,    40,    40,    40,   -11,    -6,
  880.     -1,   123,    40,    -1,   287,   266,    -4,   123,    -6,   -12,
  881.    -14,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  882.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  883.     -1,    -1,    -1,    -6,    -6,    -1,    -6,    -1,    -1,    -1,
  884.     -6,    -1,    -1,    -1,    -1,   125,    44,   125,   -11,    -1,
  885.     41,   267,   266,   -13,    -1,   -11,    41,    41,    41,    41,
  886.     41,    41,    41,    44,    41,    41,    41,    41,    41,    44,
  887.     41,    44,    44,    44,    -1,    -1,   125,    41,    93,    44,
  888.     41,    -1,    -1,    -1,    -1,    -1,    -1,    41,    41,    41,
  889.     41,    41 };
  890. int yydef[]={
  891.  
  892.      0,    -2,     1,     2,     5,     0,     0,     0,     0,     0,
  893.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  894.      0,    28,     0,     0,    38,     3,     0,    63,    64,    65,
  895.     66,    67,    68,    69,    70,    71,    73,     9,    10,    81,
  896.     -2,    78,     0,    80,    75,     4,     0,     0,    34,    36,
  897.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  898.      0,     0,     0,     0,     0,     0,     0,     0,     7,     0,
  899.      8,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  900.      0,     0,    22,     0,     0,     0,     0,     0,     0,     0,
  901.     39,    38,     0,     0,     0,    27,    29,    38,     0,     0,
  902.     38,    46,    47,    48,    49,    50,    51,    52,    53,    54,
  903.     55,    56,    57,    58,    59,    60,    61,    -2,     6,     0,
  904.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  905.      0,     0,     0,     0,     0,    32,     0,     0,     0,     0,
  906.     45,    76,    79,     0,    41,     0,    11,    12,    13,    14,
  907.     15,    16,    17,     0,    19,    20,    21,    72,    23,     0,
  908.     25,     0,     0,     0,    40,    43,    33,    44,    35,     0,
  909.     37,     0,     0,     0,     0,     0,    42,    18,    24,    26,
  910.     30,    31 };
  911. typedef struct { char *t_name; int t_val; } yytoktype;
  912. #ifndef YYDEBUG
  913. #    define YYDEBUG    0    /* don't allow debugging */
  914. #endif
  915.  
  916. #if YYDEBUG
  917.  
  918. yytoktype yytoks[] =
  919. {
  920.     "INT",    257,
  921.     "HEX",    258,
  922.     "ERROR",    259,
  923.     "UINT",    260,
  924.     "M2_TRUE",    261,
  925.     "M2_FALSE",    262,
  926.     "CHAR",    263,
  927.     "FLOAT",    264,
  928.     "STRING",    265,
  929.     "NAME",    266,
  930.     "BLOCKNAME",    267,
  931.     "IDENT",    268,
  932.     "VARNAME",    269,
  933.     "TYPENAME",    270,
  934.     "SIZE",    271,
  935.     "CAP",    272,
  936.     "ORD",    273,
  937.     "HIGH",    274,
  938.     "ABS",    275,
  939.     "MIN_FUNC",    276,
  940.     "MAX_FUNC",    277,
  941.     "FLOAT_FUNC",    278,
  942.     "VAL",    279,
  943.     "CHR",    280,
  944.     "ODD",    281,
  945.     "TRUNC",    282,
  946.     "INC",    283,
  947.     "DEC",    284,
  948.     "INCL",    285,
  949.     "EXCL",    286,
  950.     "COLONCOLON",    287,
  951.     "LAST",    288,
  952.     "REGNAME",    289,
  953.     "INTERNAL_VAR",    290,
  954.     ",",    44,
  955.     "ABOVE_COMMA",    291,
  956.     "ASSIGN",    292,
  957.     "<",    60,
  958.     ">",    62,
  959.     "LEQ",    293,
  960.     "GEQ",    294,
  961.     "=",    61,
  962.     "NOTEQUAL",    295,
  963.     "#",    35,
  964.     "IN",    296,
  965.     "OROR",    297,
  966.     "LOGICAL_AND",    298,
  967.     "&",    38,
  968.     "@",    64,
  969.     "+",    43,
  970.     "-",    45,
  971.     "*",    42,
  972.     "/",    47,
  973.     "DIV",    299,
  974.     "MOD",    300,
  975.     "UNARY",    301,
  976.     "^",    94,
  977.     "DOT",    302,
  978.     "[",    91,
  979.     "(",    40,
  980.     "NOT",    303,
  981.     "~",    126,
  982.     "QID",    304,
  983.     "-unknown-",    -1    /* ends search */
  984. };
  985.  
  986. char * yyreds[] =
  987. {
  988.     "-no such reduction-",
  989.     "start : exp",
  990.     "start : type_exp",
  991.     "type_exp : type",
  992.     "exp : exp '^'",
  993.     "exp : '-'",
  994.     "exp : '-' exp",
  995.     "exp : '+' exp",
  996.     "exp : not_exp exp",
  997.     "not_exp : NOT",
  998.     "not_exp : '~'",
  999.     "exp : CAP '(' exp ')'",
  1000.     "exp : ORD '(' exp ')'",
  1001.     "exp : ABS '(' exp ')'",
  1002.     "exp : HIGH '(' exp ')'",
  1003.     "exp : MIN_FUNC '(' type ')'",
  1004.     "exp : MAX_FUNC '(' type ')'",
  1005.     "exp : FLOAT_FUNC '(' exp ')'",
  1006.     "exp : VAL '(' type ',' exp ')'",
  1007.     "exp : CHR '(' exp ')'",
  1008.     "exp : ODD '(' exp ')'",
  1009.     "exp : TRUNC '(' exp ')'",
  1010.     "exp : SIZE exp",
  1011.     "exp : INC '(' exp ')'",
  1012.     "exp : INC '(' exp ',' exp ')'",
  1013.     "exp : DEC '(' exp ')'",
  1014.     "exp : DEC '(' exp ',' exp ')'",
  1015.     "exp : exp DOT NAME",
  1016.     "exp : set",
  1017.     "exp : exp IN set",
  1018.     "exp : INCL '(' exp ',' exp ')'",
  1019.     "exp : EXCL '(' exp ',' exp ')'",
  1020.     "set : '{' arglist '}'",
  1021.     "set : type '{' arglist '}'",
  1022.     "exp : exp '['",
  1023.     "exp : exp '[' non_empty_arglist ']'",
  1024.     "exp : exp '('",
  1025.     "exp : exp '(' arglist ')'",
  1026.     "arglist : /* empty */",
  1027.     "arglist : exp",
  1028.     "arglist : arglist ',' exp",
  1029.     "non_empty_arglist : exp",
  1030.     "non_empty_arglist : non_empty_arglist ',' exp",
  1031.     "exp : '{' type '}' exp",
  1032.     "exp : type '(' exp ')'",
  1033.     "exp : '(' exp ')'",
  1034.     "exp : exp '@' exp",
  1035.     "exp : exp '*' exp",
  1036.     "exp : exp '/' exp",
  1037.     "exp : exp DIV exp",
  1038.     "exp : exp MOD exp",
  1039.     "exp : exp '+' exp",
  1040.     "exp : exp '-' exp",
  1041.     "exp : exp '=' exp",
  1042.     "exp : exp NOTEQUAL exp",
  1043.     "exp : exp '#' exp",
  1044.     "exp : exp LEQ exp",
  1045.     "exp : exp GEQ exp",
  1046.     "exp : exp '<' exp",
  1047.     "exp : exp '>' exp",
  1048.     "exp : exp LOGICAL_AND exp",
  1049.     "exp : exp OROR exp",
  1050.     "exp : exp ASSIGN exp",
  1051.     "exp : M2_TRUE",
  1052.     "exp : M2_FALSE",
  1053.     "exp : INT",
  1054.     "exp : UINT",
  1055.     "exp : CHAR",
  1056.     "exp : FLOAT",
  1057.     "exp : variable",
  1058.     "exp : LAST",
  1059.     "exp : REGNAME",
  1060.     "exp : SIZE '(' type ')'",
  1061.     "exp : STRING",
  1062.     "block : fblock",
  1063.     "fblock : BLOCKNAME",
  1064.     "fblock : block COLONCOLON BLOCKNAME",
  1065.     "variable : fblock",
  1066.     "variable : INTERNAL_VAR",
  1067.     "variable : block COLONCOLON NAME",
  1068.     "variable : NAME",
  1069.     "type : TYPENAME",
  1070. };
  1071. #endif /* YYDEBUG */
  1072. #line 1 "/usr/lib/yaccpar"
  1073. /*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  1074.  
  1075. /*
  1076. ** Skeleton parser driver for yacc output
  1077. */
  1078.  
  1079. /*
  1080. ** yacc user known macros and defines
  1081. */
  1082. #define YYERROR        goto yyerrlab
  1083. #define YYACCEPT    { free(yys); free(yyv); return(0); }
  1084. #define YYABORT        { free(yys); free(yyv); return(1); }
  1085. #define YYBACKUP( newtoken, newvalue )\
  1086. {\
  1087.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  1088.     {\
  1089.         yyerror( "syntax error - cannot backup" );\
  1090.         goto yyerrlab;\
  1091.     }\
  1092.     yychar = newtoken;\
  1093.     yystate = *yyps;\
  1094.     yylval = newvalue;\
  1095.     goto yynewstate;\
  1096. }
  1097. #define YYRECOVERING()    (!!yyerrflag)
  1098. #ifndef YYDEBUG
  1099. #    define YYDEBUG    1    /* make debugging available */
  1100. #endif
  1101.  
  1102. /*
  1103. ** user known globals
  1104. */
  1105. int yydebug;            /* set to 1 to get debugging */
  1106.  
  1107. /*
  1108. ** driver internal defines
  1109. */
  1110. #define YYFLAG        (-1000)
  1111.  
  1112. /*
  1113. ** static variables used by the parser
  1114. */
  1115. static YYSTYPE *yyv;            /* value stack */
  1116. static int *yys;            /* state stack */
  1117.  
  1118. static YYSTYPE *yypv;            /* top of value stack */
  1119. static int *yyps;            /* top of state stack */
  1120.  
  1121. static int yystate;            /* current state */
  1122. static int yytmp;            /* extra var (lasts between blocks) */
  1123.  
  1124. int yynerrs;            /* number of errors */
  1125.  
  1126. int yyerrflag;            /* error recovery flag */
  1127. int yychar;            /* current input token number */
  1128.  
  1129.  
  1130. /*
  1131. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  1132. */
  1133. int
  1134. yyparse()
  1135. {
  1136.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  1137.     unsigned yymaxdepth = YYMAXDEPTH;
  1138.  
  1139.     /*
  1140.     ** Initialize externals - yyparse may be called more than once
  1141.     */
  1142.     yyv = (YYSTYPE*)xmalloc(yymaxdepth*sizeof(YYSTYPE));
  1143.     yys = (int*)xmalloc(yymaxdepth*sizeof(int));
  1144.     if (!yyv || !yys)
  1145.     {
  1146.         yyerror( "out of memory" );
  1147.         return(1);
  1148.     }
  1149.     yypv = &yyv[-1];
  1150.     yyps = &yys[-1];
  1151.     yystate = 0;
  1152.     yytmp = 0;
  1153.     yynerrs = 0;
  1154.     yyerrflag = 0;
  1155.     yychar = -1;
  1156.  
  1157.     goto yystack;
  1158.     {
  1159.         register YYSTYPE *yy_pv;    /* top of value stack */
  1160.         register int *yy_ps;        /* top of state stack */
  1161.         register int yy_state;        /* current state */
  1162.         register int  yy_n;        /* internal state number info */
  1163.  
  1164.         /*
  1165.         ** get globals into registers.
  1166.         ** branch to here only if YYBACKUP was called.
  1167.         */
  1168.     yynewstate:
  1169.         yy_pv = yypv;
  1170.         yy_ps = yyps;
  1171.         yy_state = yystate;
  1172.         goto yy_newstate;
  1173.  
  1174.         /*
  1175.         ** get globals into registers.
  1176.         ** either we just started, or we just finished a reduction
  1177.         */
  1178.     yystack:
  1179.         yy_pv = yypv;
  1180.         yy_ps = yyps;
  1181.         yy_state = yystate;
  1182.  
  1183.         /*
  1184.         ** top of for (;;) loop while no reductions done
  1185.         */
  1186.     yy_stack:
  1187.         /*
  1188.         ** put a state and value onto the stacks
  1189.         */
  1190. #if YYDEBUG
  1191.         /*
  1192.         ** if debugging, look up token value in list of value vs.
  1193.         ** name pairs.  0 and negative (-1) are special values.
  1194.         ** Note: linear search is used since time is not a real
  1195.         ** consideration while debugging.
  1196.         */
  1197.         if ( yydebug )
  1198.         {
  1199.             register int yy_i;
  1200.  
  1201.             (void)printf( "State %d, token ", yy_state );
  1202.             if ( yychar == 0 )
  1203.                 (void)printf( "end-of-file\n" );
  1204.             else if ( yychar < 0 )
  1205.                 (void)printf( "-none-\n" );
  1206.             else
  1207.             {
  1208.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1209.                     yy_i++ )
  1210.                 {
  1211.                     if ( yytoks[yy_i].t_val == yychar )
  1212.                         break;
  1213.                 }
  1214.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1215.             }
  1216.         }
  1217. #endif /* YYDEBUG */
  1218.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  1219.         {
  1220.             /*
  1221.             ** xreallocate and recover.  Note that pointers
  1222.             ** have to be reset, or bad things will happen
  1223.             */
  1224.             int yyps_index = (yy_ps - yys);
  1225.             int yypv_index = (yy_pv - yyv);
  1226.             int yypvt_index = (yypvt - yyv);
  1227.             yymaxdepth += YYMAXDEPTH;
  1228.             yyv = (YYSTYPE*)xrealloc((char*)yyv,
  1229.                 yymaxdepth * sizeof(YYSTYPE));
  1230.             yys = (int*)xrealloc((char*)yys,
  1231.                 yymaxdepth * sizeof(int));
  1232.             if (!yyv || !yys)
  1233.             {
  1234.                 yyerror( "yacc stack overflow" );
  1235.                 return(1);
  1236.             }
  1237.             yy_ps = yys + yyps_index;
  1238.             yy_pv = yyv + yypv_index;
  1239.             yypvt = yyv + yypvt_index;
  1240.         }
  1241.         *yy_ps = yy_state;
  1242.         *++yy_pv = yyval;
  1243.  
  1244.         /*
  1245.         ** we have a new state - find out what to do
  1246.         */
  1247.     yy_newstate:
  1248.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  1249.             goto yydefault;        /* simple state */
  1250. #if YYDEBUG
  1251.         /*
  1252.         ** if debugging, need to mark whether new token grabbed
  1253.         */
  1254.         yytmp = yychar < 0;
  1255. #endif
  1256.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1257.             yychar = 0;        /* reached EOF */
  1258. #if YYDEBUG
  1259.         if ( yydebug && yytmp )
  1260.         {
  1261.             register int yy_i;
  1262.  
  1263.             (void)printf( "Received token " );
  1264.             if ( yychar == 0 )
  1265.                 (void)printf( "end-of-file\n" );
  1266.             else if ( yychar < 0 )
  1267.                 (void)printf( "-none-\n" );
  1268.             else
  1269.             {
  1270.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  1271.                     yy_i++ )
  1272.                 {
  1273.                     if ( yytoks[yy_i].t_val == yychar )
  1274.                         break;
  1275.                 }
  1276.                 (void)printf( "%s\n", yytoks[yy_i].t_name );
  1277.             }
  1278.         }
  1279. #endif /* YYDEBUG */
  1280.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  1281.             goto yydefault;
  1282.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  1283.         {
  1284.             yychar = -1;
  1285.             yyval = yylval;
  1286.             yy_state = yy_n;
  1287.             if ( yyerrflag > 0 )
  1288.                 yyerrflag--;
  1289.             goto yy_stack;
  1290.         }
  1291.  
  1292.     yydefault:
  1293.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  1294.         {
  1295. #if YYDEBUG
  1296.             yytmp = yychar < 0;
  1297. #endif
  1298.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  1299.                 yychar = 0;        /* reached EOF */
  1300. #if YYDEBUG
  1301.             if ( yydebug && yytmp )
  1302.             {
  1303.                 register int yy_i;
  1304.  
  1305.                 (void)printf( "Received token " );
  1306.                 if ( yychar == 0 )
  1307.                     (void)printf( "end-of-file\n" );
  1308.                 else if ( yychar < 0 )
  1309.                     (void)printf( "-none-\n" );
  1310.                 else
  1311.                 {
  1312.                     for ( yy_i = 0;
  1313.                         yytoks[yy_i].t_val >= 0;
  1314.                         yy_i++ )
  1315.                     {
  1316.                         if ( yytoks[yy_i].t_val
  1317.                             == yychar )
  1318.                         {
  1319.                             break;
  1320.                         }
  1321.                     }
  1322.                     (void)printf( "%s\n", yytoks[yy_i].t_name );
  1323.                 }
  1324.             }
  1325. #endif /* YYDEBUG */
  1326.             /*
  1327.             ** look through exception table
  1328.             */
  1329.             {
  1330.                 register int *yyxi = yyexca;
  1331.  
  1332.                 while ( ( *yyxi != -1 ) ||
  1333.                     ( yyxi[1] != yy_state ) )
  1334.                 {
  1335.                     yyxi += 2;
  1336.                 }
  1337.                 while ( ( *(yyxi += 2) >= 0 ) &&
  1338.                     ( *yyxi != yychar ) )
  1339.                     ;
  1340.                 if ( ( yy_n = yyxi[1] ) < 0 )
  1341.                     YYACCEPT;
  1342.             }
  1343.         }
  1344.  
  1345.         /*
  1346.         ** check for syntax error
  1347.         */
  1348.         if ( yy_n == 0 )    /* have an error */
  1349.         {
  1350.             /* no worry about speed here! */
  1351.             switch ( yyerrflag )
  1352.             {
  1353.             case 0:        /* new error */
  1354.                 yyerror( "syntax error" );
  1355.                 goto skip_init;
  1356.             yyerrlab:
  1357.                 /*
  1358.                 ** get globals into registers.
  1359.                 ** we have a user generated syntax type error
  1360.                 */
  1361.                 yy_pv = yypv;
  1362.                 yy_ps = yyps;
  1363.                 yy_state = yystate;
  1364.                 yynerrs++;
  1365.             skip_init:
  1366.             case 1:
  1367.             case 2:        /* incompletely recovered error */
  1368.                     /* try again... */
  1369.                 yyerrflag = 3;
  1370.                 /*
  1371.                 ** find state where "error" is a legal
  1372.                 ** shift action
  1373.                 */
  1374.                 while ( yy_ps >= yys )
  1375.                 {
  1376.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  1377.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  1378.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  1379.                         /*
  1380.                         ** simulate shift of "error"
  1381.                         */
  1382.                         yy_state = yyact[ yy_n ];
  1383.                         goto yy_stack;
  1384.                     }
  1385.                     /*
  1386.                     ** current state has no shift on
  1387.                     ** "error", pop stack
  1388.                     */
  1389. #if YYDEBUG
  1390. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  1391.                     if ( yydebug )
  1392.                         (void)printf( _POP_, *yy_ps,
  1393.                             yy_ps[-1] );
  1394. #    undef _POP_
  1395. #endif
  1396.                     yy_ps--;
  1397.                     yy_pv--;
  1398.                 }
  1399.                 /*
  1400.                 ** there is no state on stack with "error" as
  1401.                 ** a valid shift.  give up.
  1402.                 */
  1403.                 YYABORT;
  1404.             case 3:        /* no shift yet; eat a token */
  1405. #if YYDEBUG
  1406.                 /*
  1407.                 ** if debugging, look up token in list of
  1408.                 ** pairs.  0 and negative shouldn't occur,
  1409.                 ** but since timing doesn't matter when
  1410.                 ** debugging, it doesn't hurt to leave the
  1411.                 ** tests here.
  1412.                 */
  1413.                 if ( yydebug )
  1414.                 {
  1415.                     register int yy_i;
  1416.  
  1417.                     (void)printf( "Error recovery discards " );
  1418.                     if ( yychar == 0 )
  1419.                         (void)printf( "token end-of-file\n" );
  1420.                     else if ( yychar < 0 )
  1421.                         (void)printf( "token -none-\n" );
  1422.                     else
  1423.                     {
  1424.                         for ( yy_i = 0;
  1425.                             yytoks[yy_i].t_val >= 0;
  1426.                             yy_i++ )
  1427.                         {
  1428.                             if ( yytoks[yy_i].t_val
  1429.                                 == yychar )
  1430.                             {
  1431.                                 break;
  1432.                             }
  1433.                         }
  1434.                         (void)printf( "token %s\n",
  1435.                             yytoks[yy_i].t_name );
  1436.                     }
  1437.                 }
  1438. #endif /* YYDEBUG */
  1439.                 if ( yychar == 0 )    /* reached EOF. quit */
  1440.                     YYABORT;
  1441.                 yychar = -1;
  1442.                 goto yy_newstate;
  1443.             }
  1444.         }/* end if ( yy_n == 0 ) */
  1445.         /*
  1446.         ** reduction by production yy_n
  1447.         ** put stack tops, etc. so things right after switch
  1448.         */
  1449. #if YYDEBUG
  1450.         /*
  1451.         ** if debugging, print the string that is the user's
  1452.         ** specification of the reduction which is just about
  1453.         ** to be done.
  1454.         */
  1455.         if ( yydebug )
  1456.             (void)printf( "Reduce by (%d) \"%s\"\n",
  1457.                 yy_n, yyreds[ yy_n ] );
  1458. #endif
  1459.         yytmp = yy_n;            /* value to switch over */
  1460.         yypvt = yy_pv;            /* $vars top of value stack */
  1461.         /*
  1462.         ** Look in goto table for next state
  1463.         ** Sorry about using yy_state here as temporary
  1464.         ** register variable, but why not, if it works...
  1465.         ** If yyr2[ yy_n ] doesn't have the low order bit
  1466.         ** set, then there is no action to be done for
  1467.         ** this reduction.  So, no saving & unsaving of
  1468.         ** registers done.  The only difference between the
  1469.         ** code just after the if and the body of the if is
  1470.         ** the goto yy_stack in the body.  This way the test
  1471.         ** can be made before the choice of what to do is needed.
  1472.         */
  1473.         {
  1474.             /* length of production doubled with extra bit */
  1475.             register int yy_len = yyr2[ yy_n ];
  1476.  
  1477.             if ( !( yy_len & 01 ) )
  1478.             {
  1479.                 yy_len >>= 1;
  1480.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1481.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1482.                     *( yy_ps -= yy_len ) + 1;
  1483.                 if ( yy_state >= YYLAST ||
  1484.                     yychk[ yy_state =
  1485.                     yyact[ yy_state ] ] != -yy_n )
  1486.                 {
  1487.                     yy_state = yyact[ yypgo[ yy_n ] ];
  1488.                 }
  1489.                 goto yy_stack;
  1490.             }
  1491.             yy_len >>= 1;
  1492.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  1493.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  1494.                 *( yy_ps -= yy_len ) + 1;
  1495.             if ( yy_state >= YYLAST ||
  1496.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  1497.             {
  1498.                 yy_state = yyact[ yypgo[ yy_n ] ];
  1499.             }
  1500.         }
  1501.                     /* save until reenter driver code */
  1502.         yystate = yy_state;
  1503.         yyps = yy_ps;
  1504.         yypv = yy_pv;
  1505.     }
  1506.     /*
  1507.     ** code supplied by user is placed in this switch
  1508.     */
  1509.     switch( yytmp )
  1510.     {
  1511.         
  1512. case 3:
  1513. # line 200 "./m2-exp.y"
  1514. { write_exp_elt_opcode(OP_TYPE);
  1515.           write_exp_elt_type(yypvt[-0].tval);
  1516.           write_exp_elt_opcode(OP_TYPE);
  1517.         } break;
  1518. case 4:
  1519. # line 209 "./m2-exp.y"
  1520. { write_exp_elt_opcode (UNOP_IND); } break;
  1521. case 5:
  1522. # line 212 "./m2-exp.y"
  1523. { number_sign = -1; } break;
  1524. case 6:
  1525. # line 214 "./m2-exp.y"
  1526. { number_sign = 1;
  1527.               write_exp_elt_opcode (UNOP_NEG); } break;
  1528. case 7:
  1529. # line 219 "./m2-exp.y"
  1530. { write_exp_elt_opcode(UNOP_PLUS); } break;
  1531. case 8:
  1532. # line 223 "./m2-exp.y"
  1533. { write_exp_elt_opcode (UNOP_LOGICAL_NOT); } break;
  1534. case 11:
  1535. # line 231 "./m2-exp.y"
  1536. { write_exp_elt_opcode (UNOP_CAP); } break;
  1537. case 12:
  1538. # line 235 "./m2-exp.y"
  1539. { write_exp_elt_opcode (UNOP_ORD); } break;
  1540. case 13:
  1541. # line 239 "./m2-exp.y"
  1542. { write_exp_elt_opcode (UNOP_ABS); } break;
  1543. case 14:
  1544. # line 243 "./m2-exp.y"
  1545. { write_exp_elt_opcode (UNOP_HIGH); } break;
  1546. case 15:
  1547. # line 247 "./m2-exp.y"
  1548. { write_exp_elt_opcode (UNOP_MIN);
  1549.               write_exp_elt_type (yypvt[-1].tval);
  1550.               write_exp_elt_opcode (UNOP_MIN); } break;
  1551. case 16:
  1552. # line 253 "./m2-exp.y"
  1553. { write_exp_elt_opcode (UNOP_MAX);
  1554.               write_exp_elt_type (yypvt[-1].tval);
  1555.               write_exp_elt_opcode (UNOP_MIN); } break;
  1556. case 17:
  1557. # line 259 "./m2-exp.y"
  1558. { write_exp_elt_opcode (UNOP_FLOAT); } break;
  1559. case 18:
  1560. # line 263 "./m2-exp.y"
  1561. { write_exp_elt_opcode (BINOP_VAL);
  1562.               write_exp_elt_type (yypvt[-3].tval);
  1563.               write_exp_elt_opcode (BINOP_VAL); } break;
  1564. case 19:
  1565. # line 269 "./m2-exp.y"
  1566. { write_exp_elt_opcode (UNOP_CHR); } break;
  1567. case 20:
  1568. # line 273 "./m2-exp.y"
  1569. { write_exp_elt_opcode (UNOP_ODD); } break;
  1570. case 21:
  1571. # line 277 "./m2-exp.y"
  1572. { write_exp_elt_opcode (UNOP_TRUNC); } break;
  1573. case 22:
  1574. # line 281 "./m2-exp.y"
  1575. { write_exp_elt_opcode (UNOP_SIZEOF); } break;
  1576. case 23:
  1577. # line 286 "./m2-exp.y"
  1578. { write_exp_elt_opcode(UNOP_PREINCREMENT); } break;
  1579. case 24:
  1580. # line 290 "./m2-exp.y"
  1581. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1582.               write_exp_elt_opcode(BINOP_ADD);
  1583.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;
  1584. case 25:
  1585. # line 296 "./m2-exp.y"
  1586. { write_exp_elt_opcode(UNOP_PREDECREMENT);} break;
  1587. case 26:
  1588. # line 300 "./m2-exp.y"
  1589. { write_exp_elt_opcode(BINOP_ASSIGN_MODIFY);
  1590.               write_exp_elt_opcode(BINOP_SUB);
  1591.               write_exp_elt_opcode(BINOP_ASSIGN_MODIFY); } break;
  1592. case 27:
  1593. # line 306 "./m2-exp.y"
  1594. { write_exp_elt_opcode (STRUCTOP_STRUCT);
  1595.               write_exp_string (yypvt[-0].sval);
  1596.               write_exp_elt_opcode (STRUCTOP_STRUCT); } break;
  1597. case 29:
  1598. # line 315 "./m2-exp.y"
  1599. { error("Sets are not implemented.");} break;
  1600. case 30:
  1601. # line 319 "./m2-exp.y"
  1602. { error("Sets are not implemented.");} break;
  1603. case 31:
  1604. # line 323 "./m2-exp.y"
  1605. { error("Sets are not implemented.");} break;
  1606. case 32:
  1607. # line 326 "./m2-exp.y"
  1608. { error("Sets are not implemented.");} break;
  1609. case 33:
  1610. # line 328 "./m2-exp.y"
  1611. { error("Sets are not implemented.");} break;
  1612. case 34:
  1613. # line 337 "./m2-exp.y"
  1614. { start_arglist(); } break;
  1615. case 35:
  1616. # line 339 "./m2-exp.y"
  1617. { write_exp_elt_opcode (MULTI_SUBSCRIPT);
  1618.               write_exp_elt_longcst ((LONGEST) end_arglist());
  1619.               write_exp_elt_opcode (MULTI_SUBSCRIPT); } break;
  1620. case 36:
  1621. # line 347 "./m2-exp.y"
  1622. { start_arglist (); } break;
  1623. case 37:
  1624. # line 349 "./m2-exp.y"
  1625. { write_exp_elt_opcode (OP_FUNCALL);
  1626.               write_exp_elt_longcst ((LONGEST) end_arglist ());
  1627.               write_exp_elt_opcode (OP_FUNCALL); } break;
  1628. case 39:
  1629. # line 358 "./m2-exp.y"
  1630. { arglist_len = 1; } break;
  1631. case 40:
  1632. # line 362 "./m2-exp.y"
  1633. { arglist_len++; } break;
  1634. case 41:
  1635. # line 367 "./m2-exp.y"
  1636. { arglist_len = 1; } break;
  1637. case 42:
  1638. # line 372 "./m2-exp.y"
  1639. { arglist_len++; } break;
  1640. case 43:
  1641. # line 377 "./m2-exp.y"
  1642. { write_exp_elt_opcode (UNOP_MEMVAL);
  1643.               write_exp_elt_type (yypvt[-2].tval);
  1644.               write_exp_elt_opcode (UNOP_MEMVAL); } break;
  1645. case 44:
  1646. # line 383 "./m2-exp.y"
  1647. { write_exp_elt_opcode (UNOP_CAST);
  1648.               write_exp_elt_type (yypvt[-3].tval);
  1649.               write_exp_elt_opcode (UNOP_CAST); } break;
  1650. case 45:
  1651. # line 389 "./m2-exp.y"
  1652. { } break;
  1653. case 46:
  1654. # line 397 "./m2-exp.y"
  1655. { write_exp_elt_opcode (BINOP_REPEAT); } break;
  1656. case 47:
  1657. # line 401 "./m2-exp.y"
  1658. { write_exp_elt_opcode (BINOP_MUL); } break;
  1659. case 48:
  1660. # line 405 "./m2-exp.y"
  1661. { write_exp_elt_opcode (BINOP_DIV); } break;
  1662. case 49:
  1663. # line 409 "./m2-exp.y"
  1664. { write_exp_elt_opcode (BINOP_INTDIV); } break;
  1665. case 50:
  1666. # line 413 "./m2-exp.y"
  1667. { write_exp_elt_opcode (BINOP_REM); } break;
  1668. case 51:
  1669. # line 417 "./m2-exp.y"
  1670. { write_exp_elt_opcode (BINOP_ADD); } break;
  1671. case 52:
  1672. # line 421 "./m2-exp.y"
  1673. { write_exp_elt_opcode (BINOP_SUB); } break;
  1674. case 53:
  1675. # line 425 "./m2-exp.y"
  1676. { write_exp_elt_opcode (BINOP_EQUAL); } break;
  1677. case 54:
  1678. # line 429 "./m2-exp.y"
  1679. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1680. case 55:
  1681. # line 431 "./m2-exp.y"
  1682. { write_exp_elt_opcode (BINOP_NOTEQUAL); } break;
  1683. case 56:
  1684. # line 435 "./m2-exp.y"
  1685. { write_exp_elt_opcode (BINOP_LEQ); } break;
  1686. case 57:
  1687. # line 439 "./m2-exp.y"
  1688. { write_exp_elt_opcode (BINOP_GEQ); } break;
  1689. case 58:
  1690. # line 443 "./m2-exp.y"
  1691. { write_exp_elt_opcode (BINOP_LESS); } break;
  1692. case 59:
  1693. # line 447 "./m2-exp.y"
  1694. { write_exp_elt_opcode (BINOP_GTR); } break;
  1695. case 60:
  1696. # line 451 "./m2-exp.y"
  1697. { write_exp_elt_opcode (BINOP_LOGICAL_AND); } break;
  1698. case 61:
  1699. # line 455 "./m2-exp.y"
  1700. { write_exp_elt_opcode (BINOP_LOGICAL_OR); } break;
  1701. case 62:
  1702. # line 459 "./m2-exp.y"
  1703. { write_exp_elt_opcode (BINOP_ASSIGN); } break;
  1704. case 63:
  1705. # line 466 "./m2-exp.y"
  1706. { write_exp_elt_opcode (OP_BOOL);
  1707.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1708.               write_exp_elt_opcode (OP_BOOL); } break;
  1709. case 64:
  1710. # line 472 "./m2-exp.y"
  1711. { write_exp_elt_opcode (OP_BOOL);
  1712.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1713.               write_exp_elt_opcode (OP_BOOL); } break;
  1714. case 65:
  1715. # line 478 "./m2-exp.y"
  1716. { write_exp_elt_opcode (OP_LONG);
  1717.               write_exp_elt_type (builtin_type_m2_int);
  1718.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1719.               write_exp_elt_opcode (OP_LONG); } break;
  1720. case 66:
  1721. # line 485 "./m2-exp.y"
  1722. {
  1723.               write_exp_elt_opcode (OP_LONG);
  1724.               write_exp_elt_type (builtin_type_m2_card);
  1725.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1726.               write_exp_elt_opcode (OP_LONG);
  1727.             } break;
  1728. case 67:
  1729. # line 494 "./m2-exp.y"
  1730. { write_exp_elt_opcode (OP_LONG);
  1731.               write_exp_elt_type (builtin_type_m2_char);
  1732.               write_exp_elt_longcst ((LONGEST) yypvt[-0].ulval);
  1733.               write_exp_elt_opcode (OP_LONG); } break;
  1734. case 68:
  1735. # line 502 "./m2-exp.y"
  1736. { write_exp_elt_opcode (OP_DOUBLE);
  1737.               write_exp_elt_type (builtin_type_m2_real);
  1738.               write_exp_elt_dblcst (yypvt[-0].dval);
  1739.               write_exp_elt_opcode (OP_DOUBLE); } break;
  1740. case 70:
  1741. # line 513 "./m2-exp.y"
  1742. { write_exp_elt_opcode (OP_LAST);
  1743.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1744.               write_exp_elt_opcode (OP_LAST); } break;
  1745. case 71:
  1746. # line 519 "./m2-exp.y"
  1747. { write_exp_elt_opcode (OP_REGISTER);
  1748.               write_exp_elt_longcst ((LONGEST) yypvt[-0].lval);
  1749.               write_exp_elt_opcode (OP_REGISTER); } break;
  1750. case 72:
  1751. # line 525 "./m2-exp.y"
  1752. { write_exp_elt_opcode (OP_LONG);
  1753.               write_exp_elt_type (builtin_type_int);
  1754.               write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (yypvt[-1].tval));
  1755.               write_exp_elt_opcode (OP_LONG); } break;
  1756. case 73:
  1757. # line 532 "./m2-exp.y"
  1758. { write_exp_elt_opcode (OP_M2_STRING);
  1759.               write_exp_string (yypvt[-0].sval);
  1760.               write_exp_elt_opcode (OP_M2_STRING); } break;
  1761. case 74:
  1762. # line 539 "./m2-exp.y"
  1763. { yyval.bval = SYMBOL_BLOCK_VALUE(yypvt[-0].sym); } break;
  1764. case 75:
  1765. # line 543 "./m2-exp.y"
  1766. { struct symbol *sym
  1767.                 = lookup_symbol (copy_name (yypvt[-0].sval), expression_context_block,
  1768.                          VAR_NAMESPACE, 0, NULL);
  1769.               yyval.sym = sym;} break;
  1770. case 76:
  1771. # line 552 "./m2-exp.y"
  1772. { struct symbol *tem
  1773.                 = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1774.                          VAR_NAMESPACE, 0, NULL);
  1775.               if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
  1776.                 error ("No function \"%s\" in specified context.",
  1777.                    copy_name (yypvt[-0].sval));
  1778.               yyval.sym = tem;
  1779.             } break;
  1780. case 77:
  1781. # line 564 "./m2-exp.y"
  1782. { write_exp_elt_opcode(OP_VAR_VALUE);
  1783.               write_exp_elt_block (NULL);
  1784.               write_exp_elt_sym (yypvt[-0].sym);
  1785.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  1786. case 78:
  1787. # line 572 "./m2-exp.y"
  1788. { write_exp_elt_opcode (OP_INTERNALVAR);
  1789.               write_exp_elt_intern (yypvt[-0].ivar);
  1790.               write_exp_elt_opcode (OP_INTERNALVAR); } break;
  1791. case 79:
  1792. # line 579 "./m2-exp.y"
  1793. { struct symbol *sym;
  1794.               sym = lookup_symbol (copy_name (yypvt[-0].sval), yypvt[-2].bval,
  1795.                            VAR_NAMESPACE, 0, NULL);
  1796.               if (sym == 0)
  1797.                 error ("No symbol \"%s\" in specified context.",
  1798.                    copy_name (yypvt[-0].sval));
  1799.  
  1800.               write_exp_elt_opcode (OP_VAR_VALUE);
  1801.               /* block_found is set by lookup_symbol.  */
  1802.               write_exp_elt_block (block_found);
  1803.               write_exp_elt_sym (sym);
  1804.               write_exp_elt_opcode (OP_VAR_VALUE); } break;
  1805. case 80:
  1806. # line 595 "./m2-exp.y"
  1807. { struct symbol *sym;
  1808.               int is_a_field_of_this;
  1809.  
  1810.                sym = lookup_symbol (copy_name (yypvt[-0].sval),
  1811.                            expression_context_block,
  1812.                            VAR_NAMESPACE,
  1813.                            &is_a_field_of_this,
  1814.                            NULL);
  1815.               if (sym)
  1816.                 {
  1817.                   if (symbol_read_needs_frame (sym))
  1818.                 {
  1819.                   if (innermost_block == 0 ||
  1820.                       contained_in (block_found, 
  1821.                             innermost_block))
  1822.                     innermost_block = block_found;
  1823.                 }
  1824.  
  1825.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1826.                   /* We want to use the selected frame, not
  1827.                  another more inner frame which happens to
  1828.                  be in the same block.  */
  1829.                   write_exp_elt_block (NULL);
  1830.                   write_exp_elt_sym (sym);
  1831.                   write_exp_elt_opcode (OP_VAR_VALUE);
  1832.                 }
  1833.               else
  1834.                 {
  1835.                   struct minimal_symbol *msymbol;
  1836.                   register char *arg = copy_name (yypvt[-0].sval);
  1837.  
  1838.                   msymbol = lookup_minimal_symbol (arg, NULL);
  1839.                   if (msymbol != NULL)
  1840.                 {
  1841.                   write_exp_msymbol
  1842.                     (msymbol,
  1843.                      lookup_function_type (builtin_type_int),
  1844.                      builtin_type_int);
  1845.                 }
  1846.                   else if (!have_full_symbols () && !have_partial_symbols ())
  1847.                 error ("No symbol table is loaded.  Use the \"symbol-file\" command.");
  1848.                   else
  1849.                 error ("No symbol \"%s\" in current context.",
  1850.                        copy_name (yypvt[-0].sval));
  1851.                 }
  1852.             } break;
  1853. case 81:
  1854. # line 645 "./m2-exp.y"
  1855. { yyval.tval = lookup_typename (copy_name (yypvt[-0].sval),
  1856.                         expression_context_block, 0); } break;
  1857.     }
  1858.     goto yystack;        /* reset registers in driver code */
  1859. }
  1860.